﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using System.Web.UI;
using System.Web.UI.WebControls;
using System.Data;
using App.Core.Extensions;
using App.Data;

public partial class Pages_Public_MediaReports : BasePage
{
    protected void Page_Load(object sender, EventArgs e)
    {
        BindPageInfo();
        if (!IsPostBack)
        {
            BindTestimonials(1);
        }
    }
    protected void BindPageInfo()
    {
        Page.Title = WebUtil.GetPageTitle(h4Heading.InnerHtml);
    }
    protected void BindTestimonials(int pageNumber)
    {
        int totalRecord = 0;
        UtilityDAO dao = new UtilityDAO();
        DataSet ds = dao.GetPagedData(AppSQL.GetPagedMediaReports(true, true), null, pageNumber, ConfigReader.TestimonialListSize, out totalRecord);
        dlMediaReportList.DataSource = ds.Tables[0];
        dlMediaReportList.DataBind();

        ///Bind the Pager Control
        ucMediaReportListPager.TotalRecord = totalRecord;
        ucMediaReportListPager.PageNo = pageNumber;
        ucMediaReportListPager.PageSize = ConfigReader.TestimonialListSize;
        ucMediaReportListPager.DataBind();

        if (ds.Tables[0].Rows.Count == 0)
            WebUtil.ShowMessageBox(divMessage, "Sorry! No Media Report found.", true);
    }
    protected String GetImageUrl(String imageFile)
    {
        return String.Format("{0}/{1}", AppConstants.MEDIA_REPORT_FILES, imageFile).UrlEncode();
    }
    protected void ucMediaReportListPager_PageIndexChanged(object sender, PagerEventArgs e)
    {
        BindTestimonials(e.PageIndex);
    }
}